<?php

/**
 * Kilometraje form base class.
 *
 * @method Kilometraje getObject() Returns the current form's model object
 *
 * @package    cronos-doctrine
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseKilometrajeForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                  => new sfWidgetFormInputHidden(),
      'empresa_id'          => new sfWidgetFormInputText(),
      'camioneta_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Camioneta'), 'add_empty' => true)),
      'fecha'               => new sfWidgetFormDate(),
      'hora_salida'         => new sfWidgetFormInputText(),
      'hora_llegada'        => new sfWidgetFormInputText(),
      'kilometraje'         => new sfWidgetFormInputText(),
      'monto_total'         => new sfWidgetFormInputText(),
      'cantidad_servicios'  => new sfWidgetFormInputText(),
      'cantidad_cancelado'  => new sfWidgetFormInputText(),
      'cantidad_recuperado' => new sfWidgetFormInputText(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'empresa_id'          => new sfValidatorInteger(array('required' => false)),
      'camioneta_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Camioneta'), 'required' => false)),
      'fecha'               => new sfValidatorDate(),
      'hora_salida'         => new sfValidatorString(array('max_length' => 100)),
      'hora_llegada'        => new sfValidatorString(array('max_length' => 100)),
      'kilometraje'         => new sfValidatorInteger(),
      'monto_total'         => new sfValidatorNumber(),
      'cantidad_servicios'  => new sfValidatorInteger(),
      'cantidad_cancelado'  => new sfValidatorInteger(),
      'cantidad_recuperado' => new sfValidatorInteger(),
      'created_at'          => new sfValidatorDateTime(),
      'updated_at'          => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('kilometraje[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Kilometraje';
  }

}
